﻿using PitOfDespair.Dungeon;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Microsoft.Xna.Framework;
using System.Linq;
using System.Collections.Generic;

namespace PitOfDespair.Tests
{


    /// <summary>
    ///This is a test class for LocationTest and is intended
    ///to contain all LocationTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LocationTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Location Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void LocationConstructor_Properties()
        {
            foreach(var wallType in GetWallTypes())
            {
                var target = new Location_Accessor(wallType, wallType, wallType, wallType);

                Assert.AreEqual(wallType, target.West);
                Assert.AreEqual(wallType, target.East);
                Assert.AreEqual(wallType, target.North);
                Assert.AreEqual(wallType, target.South);
            }
            
        }
        IEnumerable<WallType> GetWallTypes()
        {
            return Enum.GetNames(typeof (WallType)).Select(s => (WallType) Enum.Parse(typeof (WallType), s));
        }

        /// <summary>
        ///A test for Location Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void LocationConstructor_Randoms()
        {
            var west = WallType.Ascend;
            var east = WallType.Descend;
            var north = WallType.Door;
            var south = WallType.Locked;
            var target = new Location_Accessor(west,east,north ,south);
            Assert.AreEqual(west, target.West);
            Assert.AreEqual(east, target.East);
            Assert.AreEqual(north, target.North);
            Assert.AreEqual(south, target.South);

        }

        /// <summary>
        ///A test for WallColor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("PitOfDespair.exe")]
        public void WallColor_NeverThrows()
        {
            
            var target = new Location_Accessor(WallType.Locked,WallType.Open,WallType.SolidWall,WallType.Ascend);
            foreach (var wallType in GetWallTypes())
                target.WallColor(wallType);
        }

        
    }
}
